package com.example.teamilkmall.controller;

import com.example.teamilkmall.controller.vo.ResultVO;
import com.example.teamilkmall.entity.PictureInfo;
import com.example.teamilkmall.entity.PictureInfo;
import com.example.teamilkmall.entity.TeaInfo;
import com.example.teamilkmall.service.PictureInfoServive;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/pictureInfo")
public class PictureInfoController extends BaseController{
    private final PictureInfoServive pictureInfoServive;

    public PictureInfoController(PictureInfoServive pictureInfoServive) {
        this.pictureInfoServive = pictureInfoServive;
    }
    @GetMapping("/listPictureInfo")
    public ResultVO<PageInfo<PictureInfo>> listAdmin(Integer limit, Integer page, String name){
        PageInfo<PictureInfo> pageInfo = pictureInfoServive.listPictureInfo(limit, page, name);
        return success(pageInfo);
    }

    @PostMapping("/updatePictureInfo")
    public ResultVO updateAdmin(PictureInfo admin){
        pictureInfoServive.updatePictureInfo(admin);
        return success();
    }

    @PostMapping("/delonePictureInfo")
    public ResultVO deloneAdmin(Integer id){
        pictureInfoServive.delonePictureInfo(id);
        return success();
    }

    @PostMapping("/addPictureInfo")
    public ResultVO addAdmin(PictureInfo admin){
        pictureInfoServive.addPictureInfo(admin);
        return success();
    }

    @PostMapping("/listPictureInfoAll")
    public ResultVO<List<PictureInfo>> getAdminList(){
        return success(pictureInfoServive.getListPictureInfo());
    }

}
